
import { Hello, Button, SpaceWraper, Table, DemoCard, Input, Select } from "@teach_wmg_21";


var enumMap = {
    valid: [
        { value: '', label: '==请选择==' },
        { value: '1', label: '有效' },
        { value: '0', label: '无效' },
    ],
    orderType: [
        { value: '', label: '==请选择==' },
        { value: '1', label: '下单成功' },
        { value: '2', label: '订单审核' },
        { value: '3', label: '等待付款付款' },
    ]
}

function getItemFromArray(arr, value) {
    return arr.find(item => item['value'] == value)
}

export default class BuzSelect extends React.Component {

    constructor(props) {
        super(props);

        this.state = {

        }
    }

    render() {
        var { placeholder = "==请选择==", options, enumType, my_value, ...rest } = this.props;

        var valueOption = getItemFromArray(enumMap[enumType], my_value)

        return <Select placeholder={placeholder} value={valueOption} options={enumMap[enumType]} {...rest} />
    }
}